package com.example.yls.demob;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button btnSendWeather;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initSendWeather();

    }


    private void initSendWeather(){
        btnSendWeather = findViewById(R.id.btn_sendWeather);
        btnSendWeather.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction("Weather_Report");
                intent.putExtra("Weather","sunny");
                intent.putExtra("temprature",25);
                sendBroadcast(intent);

            }
        });
    }
}
